c-----------------------------------------------------------------------
c     Code to implement computation of mass aspect function.  Note that 
c     RNPL generates the subroutine header, declaration of subroutine 
c     parameters, as well as the return/end statements.  Following 
c     compilation, examine the file 'updates.f' to see how this fragment 
c     is incorporated into the update routine 'update_mass' per se.
c-----------------------------------------------------------------------
      integer     nx
      integer     j

      nx = g1_nx

      mass_np1(1) = 0.0d0
      do j = 1 , nx - 1
         mass_np1(j+1) = mass_np1(j) + 0.25d0 * dx * (
     &      (pp_np1(j)**2   + pi_np1(j)**2)  +
     &      (pp_np1(j+1)**2 + pi_np1(j+1)**2)
     &                                               )
      end do
